<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<h5 style="margin: 8px 39px;color: red;">带 * 号为必填选项</h5>
<form:form commandName="coordinate" cssClass="form-horizontal" role="form">
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="projectName"><span style="color:red;">* </span>企业或项目名称</label>
        <div class="col-sm-4">
            <input type="text" name="projectName" id="projectName" placeholder="企业或项目名称"
                   value="${coordinate.projectName}" class="form-control " required>
        </div>

        <label class="col-sm-2 control-label no-padding-right" for="resDept"><span
                style="color:red;">* </span>责任单位</label>
        <div class="col-sm-4">
            <input type="text" name="resDept" id="resDept" placeholder="企业或项目的责任单位" value="${coordinate.resDept}"
                   class="form-control " required>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="contact"><span
                style="color:red;">* </span>责任单位经办人</label>
        <div class="col-sm-4">
            <input type="text" name="contact" id="contact" placeholder="责任单位经办人" value="${coordinate.contact}"
                   class="form-control " required>
        </div>
        <label class="col-sm-2 control-label no-padding-right" for="contact">附件</label>
        <div class="col-sm-3">
            <button class="btn btn-sm btn-primary downloadFile" data-id="${coordinate.taxproof}"
                    style="width: 100%;">
                下载附件
            </button>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="baseInfo">基本情况</label>
        <div class="col-sm-10">
            <textarea rows="2" id="baseInfo" name="baseInfo" placeholder="基本情况"
                      class="form-control ">${coordinate.baseInfo}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="helpInfo"><span
                style="color:red;">* </span>需协调事项</label>
        <div class="col-sm-10">
            <textarea id="helpInfo" name="helpInfo" rows="3" placeholder="需协调事项" class="form-control "
                      required>${coordinate.helpInfo}</textarea>
        </div>
    </div>

    <%--<div class="form-group">--%>
        <%--<label class="col-sm-2 control-label no-padding-right" for="feedback"><span--%>
                <%--style="color:red;">* </span>问题反馈</label>--%>
        <%--<div class="col-sm-10">--%>
            <%--<textarea id="feedback" name="feedback" rows="3" placeholder="问题反馈" class="form-control "--%>
                      <%--required>${coordinate.feedback}</textarea>--%>
        <%--</div>--%>
    <%--</div>--%>

    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="deptLists"><span
                style="color:red;">* </span>涉及单位</label>
        <div class="col-sm-4">
                <%--  <input type="text" name="involveUnit" id="involveUnit" placeholder="涉及单位" value="${coordinate.involveUnit}"
                         class="form-control " required>--%>
            <select name="involveUnit" id="deptLists" class="form-control departments" multiple="multiple">
                <optgroup label="">

                    <c:forEach items="${deptLists}" var="deptLists">
                        <c:if test="${deptLists.branchType == 'selected'}">
                            <option value="${deptLists.branch}" selected>${deptLists.branch}</option>
                        </c:if>
                        <c:if test="${deptLists.branchType == 'noSelected'}">
                            <option value="${deptLists.branch}">${deptLists.branch}</option>
                        </c:if>
                    </c:forEach>

                </optgroup>
            </select>

        </div>
        <label class="col-sm-2 control-label no-padding-right" for="organizers"><span
                style="color:red;">* </span>承办单位</label>
        <option id="selecredOption" value="${coordinate.organizer}" hidden>${coordinate.organizer}</option>
        <div class="col-sm-4">
            <select name="organizer" id="organizers" class="form-control">
                <option value="${coordinate.organizer}">${coordinate.organizer}</option>
                <c:forEach items="${deptLists}" var="deptLists">
                    <option value="${deptLists.branch}"
                            selected="${deptLists.branch}">${deptLists.branch}</option>
                </c:forEach>
            </select>
        </div>
    </div>

    <%--<div class="form-group">--%>
        <%--<label class="col-sm-2 control-label no-padding-right" for="boss">单位负责人</label>--%>
        <%--<div class="col-sm-4">--%>
            <%--<input type="text" name="boss" id="boss"--%>
                   <%--value="${coordinate.boss}" class="form-control " >--%>
        <%--</div>--%>
        <%--<label class="col-sm-2 control-label no-padding-right" for="bossPhone">负责人手机号</label>--%>
        <%--<div class="col-sm-4">--%>
            <%--<input type="text" name="bossPhone" id="bossPhone"--%>
                   <%--value="${coordinate.bossPhone}" class="form-control "--%>
                   <%--onkeyup="value=value.replace(/[^\d]/g,'')" maxlength=11>--%>
        <%--</div>--%>
    <%--</div>--%>

    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="resUser"><span
                style="color:red;">* </span>单位直接责任人</label>
        <div class="col-sm-4">
            <input type="text" name="resUser" id="resUser"
                   value="${coordinate.resUser}" class="form-control " required>
        </div>
        <label class="col-sm-2 control-label no-padding-right" for="resUserPhone"><span style="color:red;">* </span>责任人手机号</label>
        <div class="col-sm-4">
            <input type="text" name="resUserPhone" id="resUserPhone"
                   value="${coordinate.resUserPhone}" class="form-control " required
                   onkeyup="value=value.replace(/[^\d]/g,'')" maxlength=11>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="operator"><span
                style="color:red;">* </span>单位经办人</label>
        <div class="col-sm-4">
            <input type="text" name="operator" id="operator"
                   value="${coordinate.operator}" class="form-control " required>
        </div>
        <label class="col-sm-2 control-label no-padding-right" for="operatorPhone"><span style="color:red;">* </span>经办人手机号</label>
        <div class="col-sm-4">
            <input type="text" name="operatorPhone" id="operatorPhone" placeholder="经办人手机号"
                   value="${coordinate.operatorPhone}" class="form-control  " required
                   onkeyup="value=value.replace(/[^\d]/g,'')" maxlength=11>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="fGcountyLeader"><span style="color:red;">* </span>分管县领导</label>
        <div class="col-sm-4">
            <input type="text" name="fGcountyLeader" id="fGcountyLeader"
                   value="${coordinate.fGcountyLeader}" class="form-control " required>
        </div>
        <label class="col-sm-2 control-label no-padding-right" for="fGcountyLeaderPhone"><span
                style="color:red;">* </span>分管县领导手机号</label>
        <div class="col-sm-4">
            <input type="text" name="fGcountyLeaderPhone" id="fGcountyLeaderPhone"
                   value="${coordinate.fGcountyLeaderPhone}" class="form-control " required
                   onkeyup="value=value.replace(/[^\d]/g,'')" maxlength=11>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right" for="reportUser"><span
                style="color:red;">* </span>上报人</label>
        <div class="col-sm-4">
            <input type="text" name="reportUser" id="reportUser"
                   value="${coordinate.reportUser}" class="form-control " readonly>
        </div>
        <label class="col-sm-2 control-label no-padding-right" for="reportUserPhone"><span style="color:red;">* </span>上报联系人手机号</label>
        <div class="col-sm-4">
            <input type="text" name="reportUserPhone" id="reportUserPhone"
                   value="${coordinate.reportUserPhone}" class="form-control " required
                   onkeyup="value=value.replace(/[^\d]/g,'')" maxlength=11>
        </div>
    </div>
    <form:hidden path="sysId"/>
</form:form>
<hr width="100%;height:2px;">
<div class="row" style="margin-left: 40px;">
    * 以上按住如此标志：<img src="/assets/web/img/zzc.png"  alt="提示" />可拖动调整相应输入框大小
</div>
<script>
    //涉及部门
    $(".departments").change(function () {
        var selectedArr = $(".fs-label").text().split(",");//获取已选择部门
        var selecredOption = $("#selecredOption").val();//获取已选中的承办单位
        var html='\<option value="'+selecredOption+'">'+selecredOption+'</option>';
        for(var i =0;i<selectedArr.length;i++){
            html+='\
            <option value="'+selectedArr[i]+'">'+selectedArr[i]+'</option>\
            ';
        }
        //承办单位需从已选涉及部门中选择
        $("#organizers").html(html);

    });
    $('.departments').fSelect();

    $(".downloadFile").each(function(){
        if(isEmpty($(this).data("id"))){
            $(this).attr("style","display:none;");
        }
    });
    /**
     * 下载
     */
    $(".downloadFile").click(function () {

        var id = $(this).data("id");
        var url = "/communal/download/" + id;
        window.open(url);
    });
</script>

